package de.fhhof.robot.control.cmd.concreate;

import de.fhhof.robot.control.cmd.AbstractCommand;
import de.fhhof.robot.control.cmd.SAPCommandFactory;

public class CmdAbortAssemblyProcess extends AbstractCommand {

	@Override
	public void executeCommand() {
		/** Message received */
		this.msg.ack("A001", "");
		
		/** Is there any running assembly process */
		AbstractCommand assemblyCmd = SAPCommandFactory.getCurrentAssemblyCommand();

		if(assemblyCmd != null){
			//this.msg.ack("A004x", "");
			assemblyCmd.abortCommand();
		}
		else{
			/** No assembly command is running */
			this.msg.ack("F004", "");
		}
	}

	@Override
	public void abortCommand() {
		SAPCommandFactory.getCurrentAssemblyCommand().abortCommand();
	}

	
}
